Showing posts with label figure. Show all posts
Showing posts with label figure. Show all posts

Monday, March 26, 2012

please help

Hi,

Can anyone suggest me some good tools to format my aspx page , my aspx page
in an application is very much poorly formatted,
I can't even figure out some of the ending tags exactly and aspx
code-behind really look bad.( I know the vs.net edit and formatting will do
up to a limit )

Also i am not sure is there any specific format that we should follow in
the aspx code behind like 65 chars per line(something like this).Can any one
point me to a link reg this?

Is there any add ins or some tools , that we can use in vs.net editor , so
that some of the conditions will be applied automatically while we create
the aspx page.

Excuse my english.

Thanks in advance
HariAs far as specific formats, there isn't really any. I don't like line breaks
and I use 3 spaces for indentation..but it's really up to each team to
create it's own standards. If you can't stand horizontal scrolling, then
maybe you should wrap (although, with proper use of CSS, only the most
complex sites, or the smallest monitors, cause a horizontal scroll I find).

Visual Studio 2003 is notorious for messing up your HTML. This is quite
unfortunate and I don't think there's much you can do about it. The 2005
editor is much easier to work with.

Sorry, but I don't think you'll find any automated answer short of working
hard at it.

Karl
--
http://www.openmymind.net/

"Hari" <sivakumar_ani@.yahoo.com> wrote in message
news:ek6gJEePGHA.2696@.TK2MSFTNGP14.phx.gbl...
> Hi,
> Can anyone suggest me some good tools to format my aspx page , my aspx
> page
> in an application is very much poorly formatted,
> I can't even figure out some of the ending tags exactly and aspx
> code-behind really look bad.( I know the vs.net edit and formatting will
> do
> up to a limit )
>
> Also i am not sure is there any specific format that we should follow in
> the aspx code behind like 65 chars per line(something like this).Can any
> one
> point me to a link reg this?
> Is there any add ins or some tools , that we can use in vs.net editor , so
> that some of the conditions will be applied automatically while we create
> the aspx page.
> Excuse my english.
> Thanks in advance
> Hari

Saturday, March 24, 2012

Please help a newbie...

I cannot for the life of me figure out why I cannot run an ASP.NET app. Everytime I try to view in browser/debug I get the error:

maps to a directory outside this application, which is not supported.

I am using Visual Studio 2003. Could someone please enlighten me on what is going wrong here. I am a newbie so if the solution is simple please forgive my ignorance...thanksI have never heard of this error, and it isn't documented in MSDN. My guess is there is a mis-configuration in IIS. Sorry I can't be more specific.
Can you show sources for the page you are trying to view? Especially parts referring to elsewhere (like trying to reference user control etc)

Maybe you can have a look at the following post:

App_GlobalResources maps to a directory outside this application, which is not supported

Hope this helps,

Regards


thanks for posting that link...that is exactly what the problem was. I had a "\" at the end of the file path for the home directory...

thanks again, you saved me

That is so coolBig Smile [:D]

I am happy you solved your problem.

Regards

Wednesday, March 21, 2012

Please help me figure this out!

I hope someone answers this thread, I am loosing my mind googling tofind a solution to this and nothing seems to work. I am trying tobuild an application that will let me send an e-mail message with a maxof 5 attachments, the problem that I have faced is that the filesupload fine to the server and then theiy are mailed but for some reason, when I try to add a file.delete() statement after sending the messageI get an error saying: "The file cannot be deleted because it is beingused by another process"... I close explorer, go to the foldercontaining the uploaded files and I try to delete them manually and Ikeep getting the same error "the file is being used by anotherapplicaton" ....
I don't know what I should add to my code tomake this work , here's what I have. I commented out the lines that arethrowing me this error:

Imports System.IO

PartialClass cadil

Inherits System.Web.UI.Page

Dim emaildestinoAsString

Dim strDondeAsString

ProtectedSub btnSend_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles btnSend.Click

Try

If txtSubject.Text =""Then

lblMessage.Visible =True

lblMessage.ForeColor = Drawing.Color.Red

lblMessage.Text ="* you must type your name below *"

ExitSub

EndIf

IfNot ddEscuela.SelectedItem.Value ="NADA"Then

If ddEscuela.SelectedItem.Value ="CADIL"Then

emaildestino = "email0@dotnet.itags.org.mymail.com"

EndIf

If ddEscuela.SelectedItem.Value ="ARCOIRIS"Then

emaildestino = "email1@dotnet.itags.org.mymail.com"

EndIf

If ddEscuela.SelectedItem.Value ="LABORAL"Then

emaildestino = "email2@dotnet.itags.org.mymail.com"

EndIf

Dim emailAsNew System.Net.Mail.MailMessage(txtSubject.Text.ToUpper &" <no_responder@dotnet.itags.org.ultramega.cl>", emaildestino)

email.Subject ="Documentos desde la Web"

email.Body = txtBody.Text

Dim mailClientAsNew System.Net.Mail.SmtpClient

Dim basicAuthenticationInfoAsNew System.Net.NetworkCredential("no_responder@dotnet.itags.org.ultramega.cl","**secret**")

'Put your own, or your ISPs, mail server name on this next line

mailClient.Host ="mail.ultramega.cl"

mailClient.UseDefaultCredentials =False

mailClient.Credentials = basicAuthenticationInfo

Dim attach1AsString =Nothing

Dim attach2AsString =Nothing

Dim attach3AsString =Nothing

Dim attach4AsString =Nothing

Dim attach5AsString =Nothing

Dim strFileNameAsString =Nothing

IfNot Attachment1.PostedFileIsNothingThen

Dim UploadFileAs HttpPostedFile = Attachment1.PostedFile

Dim UploadFileLenAsInteger = UploadFile.ContentLength

If UploadFileLen > 0Then

strFileName = Path.GetFileName(Attachment1.PostedFile.FileName)

strFileName ="attachments/" + strFileName

Attachment1.PostedFile.SaveAs(Server.MapPath(strFileName))

Dim attachAs System.Net.Mail.Attachment =New System.Net.Mail.Attachment(Server.MapPath(strFileName))

email.Attachments.Add(attach)

attach1 = strFileName

EndIf

EndIf

IfNot Attachment2.PostedFileIsNothingThen

Dim UploadFileAs HttpPostedFile = Attachment2.PostedFile

Dim UploadFileLenAsInteger = UploadFile.ContentLength

If UploadFileLen > 0Then

strFileName = Path.GetFileName(Attachment2.PostedFile.FileName)

strFileName ="attachments/" + strFileName

Attachment2.PostedFile.SaveAs(Server.MapPath(strFileName))

Dim attachAs System.Net.Mail.Attachment =New System.Net.Mail.Attachment(Server.MapPath(strFileName))

email.Attachments.Add(attach)

attach2 = strFileName

EndIf

EndIf

IfNot Attachment3.PostedFileIsNothingThen

Dim UploadFileAs HttpPostedFile = Attachment3.PostedFile

Dim UploadFileLenAsInteger = UploadFile.ContentLength

If UploadFileLen > 0Then

strFileName = Path.GetFileName(Attachment3.PostedFile.FileName)

strFileName ="attachments/" + strFileName

Attachment3.PostedFile.SaveAs(Server.MapPath(strFileName))

Dim attachAs System.Net.Mail.Attachment =New System.Net.Mail.Attachment(Server.MapPath(strFileName))

email.Attachments.Add(attach)

attach3 = strFileName

EndIf

EndIf

IfNot Attachment4.PostedFileIsNothingThen

Dim UploadFileAs HttpPostedFile = Attachment4.PostedFile

Dim UploadFileLenAsInteger = UploadFile.ContentLength

If UploadFileLen > 0Then

strFileName = Path.GetFileName(Attachment4.PostedFile.FileName)

strFileName ="attachments/" + strFileName

Attachment4.PostedFile.SaveAs(Server.MapPath(strFileName))

Dim attachAs System.Net.Mail.Attachment =New System.Net.Mail.Attachment(Server.MapPath(strFileName))

email.Attachments.Add(attach)

attach4 = strFileName

EndIf

EndIf

IfNot Attachment5.PostedFileIsNothingThen

Dim UploadFileAs HttpPostedFile = Attachment5.PostedFile

Dim UploadFileLenAsInteger = UploadFile.ContentLength

If UploadFileLen > 0Then

strFileName = Path.GetFileName(Attachment5.PostedFile.FileName)

strFileName ="attachments/" + strFileName

Attachment5.PostedFile.SaveAs(Server.MapPath(strFileName))

Dim attachAs System.Net.Mail.Attachment =New System.Net.Mail.Attachment(Server.MapPath(strFileName))

email.Attachments.Add(attach)

attach5 = strFileName

EndIf

EndIf

mailClient.Send(email)

' If Not attach1 Is Nothing Then

' File.Delete(attach1)

' End If

lblMessage.Visible =True

lblMessage.Text ="your files have been sent."

lblMessage2.Visible =True

Else

lblMessage.Visible =True

lblMessage.ForeColor = Drawing.Color.Red

lblMessage.Text ="* you must select one from the list*"

EndIf

Catch exAs Exception

lblMessage.Text = ex.ToString()

EndTry

EndSub

EndClass


Please someone, any ideas willbe very appreciate......... I'm stuck with this :(
hello?
Perhaps the object is still being held, perhaps by the save operation? I've never used file uploading, so I'm just taking a shot here...

it sounds like the attachment object is still being used (open). try dispose() for each attachment after you send.

http://msdn2.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx


Thank you , I tried adding an attach1.Dispose() after sending the e-mail but I got an error saying Dispose is not a member of String so I believe I am not using the correct object?

I will take a closer look over the weekend

Any additional inputs will be appreciated!


Thank you for your help. I fixed this by adding an

email.Dispose()

statement right after emailclient.send(email)

thanks!!