#gets appended at the end of url on clicking rad tab - c#

I have uploaded my application to live server published code into iis my tab doesn't works on live,tab gets post back on the local, # gets appended automatically at the end of the url unable to postback on the server which causes the postback working to stop.

Look for JavaScript errors on your page. If there are, the tab will not be able to execute its JS logic, so it will act as an ordinary anchor and add the hash to the URL.
It is often the case that webresources do not load on your production server because of permissions. Check these two articles for more info on troubleshooting that:
http://www.telerik.com/help/aspnet-ajax/introduction-troubleshooting.html
http://www.telerik.com/help/aspnet-ajax/introduction-web-resources-troubleshooting.html
You will, most likely, need to let your user access webresource:
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Also, you can try using the CDN to avoid loading resources from your server: http://www.telerik.com/help/aspnet-ajax/scriptmanager-cdn-support.html. If you have it enabled already, then you may not have connection to the cloud where the scrips come from, so you can consider disabling it.

Related

Random Invalid Viewstate Error

I know there are a lot of questions on this topic and I have read them all.
I'm using IIS8, .Net 4.5.
Users randomly get an invalid viewstate error, I can't figure it out. Once this happens the only way they can get back into the site is to clear browser cache.
In my web.config I have:
<system.web>
<machineKey validationKey='....key here' decryptionKey='....decrypt key is valid here' validation='SHA1'/>
<!--<hostingEnvironment shadowCopyBinAssemblies="false" />-->
<authentication mode="None" />
<compilation targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
...
</system.web>
I'm running on a virtual private server, and I've yet to find a viewstate larger than 9kb.
My application pool is set to restart at 3:00am, once per day.
My page uses update panels, maybe the user is clicking 'back'? But I've seen it happen just visiting the page with no clicking back.
One thing I noticed is I have 3 different sites using the same application pool identity, but the application pools are seperate. There is no machine keys in machine.xml, but only in my web.config.
A couple of possibilities to investigate:
Update panels are changing form field values (which are what is used to compute ViewState), then the page gets POSTed back to the server, where the new values make validation fail. See this post
You have caching enabled (perform a trace of HTTP headers - make sure you don't have dev tools open) which is causing invalid ViewState to be generated w/ UpdatePanel gumming things up.
Are you using Server.Execute anywhere? (see above link for same)
(less likely) Does your "Virtual Private Server" get migrated to different hardware (perhaps without you knowing it)?

Getting broken images on localhost but not on websites

On our website we have images dropped on a grid with the following line:
imgUpdated.ImageUrl = "./images/Test_Icon.gif";
This works fine when published to production or test websites but within the IDE it gives broken (Red-X) images. Properties on the broken image says this:
http://localhost:52168/OurApp/images/Test_Icon.gif
If I attempt to past that into a browser, it redirects me to the login page with the following URL:
http://localhost:52168/OurApp/login.aspx?ReturnUrl=%2fITRequest%2fimages%2fTest_Icon.gif
I'd appreciate any help you might offer. I've already tried setting up a virtual directory in IIS and taking out the period but that didn't help.
create a web.config file with the following xml and place it in your images folder
<configuration>
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</configuration>
This is likely the reason your IDE doesn't show the images. If your browser is giving a 401 response and redirecting to your login page, the IDE is expecting an image MINE type.
You can find more information on the authorization section
Your image or any other content paths should start with forward slash / which points always to the root of your website. That way no matter in what environment you are your path will always be the same. So, answering your question... your path should look like this:
imgUpdated.ImageUrl = "/images/Test_Icon.gif";

"location" based Authorization

I have a VS 2008 web application running on IIS 6. In the web.Config wile there is a section like this:
<location path="public">
<system.web>
<authorization>
<allow users="?"/>
<allow users="*"/>
</authorization>
</system.web>
</location>
I have a user control which is used on numerous pages in various locations to provide content. I want that control to filter content based on the location of the page it is on. For example, if the control is on an aspx page located in the "public" folder as specified in the sample above, I would like certain information to not be displayed.
How can I accomplish this in my codebehind? It may also be that this web.Config setting is completely irrelevant, to this question, you decide. VB or C# are fine, I can translate.
Perhaps something like this? If path.Contains("public") Then filterResults()
Thanks! :)
I would add a public property to the user control called "Mode" OR "ContextUrl" or something to that effect. Then branch logic off of that property. You should also have a 'default' set of logic.
Ultimately, having this behavior dictated by a public property is something that is more intuitive and testable to the "developer" who is interacting with your user control as opposed to something hidden in the controls implementation.

The same REST service, different behavior for different virtual directories. 404 error

1- I have a piece of code that is deployed on the server. This code calls for a REST service.
2- The same physical server, where the code is, is being pointed at by multiple virtual directories, each virtual folder has a different name.
3- For the first virtual directory, everything is working fine and the code calls the REST service.
4- For the second virtual directory, which points to the same exact code, and points to the same physical folder (not even a copy of the code) can't find the REST service, it gives 404.
Any idea what could be happening? I am not sure if this is enough information or not, I would be glad to provide more.
The URL is constructed dynamically this way
RouteTable.Routes.Add(new ServiceRoute("rest/AuthenticationAttempt", new WebServiceHostFactory(), typeof(AuthenticationService)));
In the web.config, I have this
<location path="rest">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
The service URL is
http://10.30.10.172/OnlineServicing/rest/AuthenticationAttempt/
OnlineServicing is the virtual directory name, AuthenticationAttempt is the service name. However, the deployed code doesn't have a rest folder, it looks like the code handles this.

Response.WriteFile from other aspx file

I have a Login.aspx page, and I wanna incude some piece of code in that page. I know I can do Response.WriteFile ("HelloMessage.aspx"), but if I simply do Project->New Item->Web Page, the GelloMessage.aspx page will be accesible throught Web browser. I wanna do this HelloMessage.aspx file unaccessible.
How to do this?
And question 2, can I keep aspx files in my custom folders?
Yes, you can keep apsx files in subfolders. Those folders become part of the URL (as long as you don't add routing).
And you can block files using the <authorize> tag in web.config. Which could solve your fist problem (but to who would you allow access to Hello.aspx ?)
Every folder can has its own web.config. So, an easy example:
For all pages in the same folder as this config, deny access to anonymous users and allow access to all logged-in users:
<authorization>
<deny users="?" />
<allow users = "*" />
</authorization>
If you have some markup that you'd like to include in several pages, then you should either use a user control, or perhaps a master page.

Categories

Resources